import { get, post, del } from "@/utils/request";
import { type CompanyList, type AddListData, type addData, type CompanyListReturn } from "./type";

//列表
export const getCompanyList = (data: CompanyList) => {
  return get<CompanyList, CompanyListReturn>("/api/company/list", data);
};

// 添加
export const CompanyAdd = (data: addData) => {
  return post<addData, AddListData>("/api/company/add", data);
};
// 获取单条数据
export const CompanyGet = (id: number) => {
  return get<number, AddListData>(`/api/company/get/${id}`);
};
// 修改
export const CompanyUpdate = (data: AddListData) => {
  return post<AddListData, AddListData>("/api/company/add", data);
};

//删除
export const delCompany = (id: number) => {
  return del<number, null>(`/api/company/delete/${id}`);
};
//批量删除
export const delMany = (ids: number[]) => {
  return post<number[], null>("/api/company/deleteAll", ids);
};
// 省份

export const companyGetcityAPI = () => {
  return get<number[], null>("/api/company/getCity");
};
